class Myarry<T>{
    public Object[] arr=new Object[5];
    public T getpos(int pos){
        return (T)this.arr[pos];
    }
    public void setval(int pos,T val){
        this.arr[pos]=val;
    }
}

public class Main {
    public static void main1(String[] args) {
        Myarry<Integer> myarry=new Myarry<>();//使用整型
        myarry.setval(0,11);
        myarry.setval(1,12);
        int ret=myarry.getpos(1);
        System.out.println(ret);

        //使用String类型也同理
        Myarry<String> myarry2=new Myarry<>();
        myarry2.setval(0,"hello");
        myarry2.setval(1,"world");
        String ret2=myarry2.getpos(0);
        String ret3=myarry2.getpos(1);
        System.out.println(ret2+" "+ret3);
    }


    }




